<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('部署一个流程')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-deploy">
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">流程定义文件：</label>
				<div class="col-sm-8">
					<input class="form-control" type="file" name="uploadfile" id="uploadfile" required>
				</div>
				<font color="red" class="pull-left mt10">
					提示：仅允许导入“bpmn”、“xml”或“zip”格式文件！
				</font>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		function submitHandler() {
			if ($.validate.form()) {
				var formData = new FormData($('#form-deploy')[0]);
				$.ajax({
					url: "/flow/manage/uploadworkflow",
					data: formData,
					cache: false,
					contentType: false,
					processData: false,
					type: 'POST',
					success: function (result) {
						if (result.code == web_status.SUCCESS) {
							$.modal.closeAll();
							$.modal.alertSuccess(result.msg);
						} else if (result.code == web_status.WARNING) {
							layer.close(index);
							$.modal.enable();
							$.modal.alertWarning(result.msg)
						} else {
							layer.close(index);
							$.modal.enable();
							$.modal.alertError(result.msg);
						}
						// 刷新父页面
						$.operate.successCallback(result);
					}
				});
			}
		}
	</script>
</body>
</html>
